<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>福轨综合办公门户</title>
        <link rel="stylesheet" type="text/css" href="/Public/Admin/css/simple-calendar.css"/>
        <link rel="stylesheet" type="text/css" href="/Public/Admin/css/swiper.css"/>
        <link rel="stylesheet" type="text/css" href="/Public/Admin/css/index.css"/>

        <script type="text/javascript" src="/Public/Admin/js/jquery.min.js"></script>
        <script src="/Public/Admin/js/swiper.js" type="text/javascript" charset="utf-8"></script>
        <script src="/Public/static/echarts/echarts.common.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/Public/Admin/js/simple-calendar.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript" src="/Public/static/layer/layer.js" ></script>
        <script type="text/javascript" src="/Public/Admin/js/new_index.js" ></script>

        <!--日程-->
        <!--<link rel="stylesheet" type="text/css" href="/Public/static/fullcalendar/css/main.css"/>-->
        <!--        <link rel="stylesheet" type="text/css" href="/Public/static/fullcalendar/css/fullcalendar.css"/>
                <link rel="stylesheet" type="text/css" href="/Public/static/fullcalendar/css/fancybox.css"/>-->
        <script src="/Public/static/fullcalendar/js/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
        <script src="/Public/static/fullcalendar/js/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
        <script src="/Public/static/fullcalendar/js/fullcalendar.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="/Public/static/fullcalendar/js/jquery.fancybox-1.3.1.pack.js" type="text/javascript" charset="utf-8"></script>
        <style>

        </style>
    </head>
    <body>
        <div class="page-index">
            <div class="headWrap">
                <div class="head clearfix">
                    <div class="logo fl">
                        <img src="/Public/Admin/images/logo.svg" />
                    </div>
                    <div class="nav fl positionR">
                        <ul>
                            <li class="active"><a href="/">首页</a></li>
                            <foreach name="userMenus" item="menu" key="key">
                                <li>
                                    <a href="javascript:;">{$menu.name}</a>
                                    <div class="subNav1">
                                        <ul>
                                            <foreach name="menu.child" item="child">
                                                <li><a href="<if condition='$child[param] neq null'>/index.php/Home/{$child.url}&{$child.param}<else/>/index.php/Home/{$child.url}</if>"  data-url="/index.php/Home/{$child.url}">{$child.name}</a></li>
                                            </foreach>
                                        </ul>
                                    </div>
                                </li>
                            </foreach>
                            <li>
                                <a href="/">问题与建议</a>
                                <div class="subNav1">
                                    <ul>
                                        <if condition="$is_handle neq 1">
                                            <li>
                                                <a href="#" class="question">提出问题</a>
                                            </li>
                                        </if>
                                        <li>
                                            <a href="#" class="questionList"><if condition="$is_handle eq 1">问题列表<else />我的问题</if></a>
                                        </li>
                                    </ul>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="user fr positionR">
                        <div class="headIcon positionR">
                            <i class="iconfont">&#xe654;</i>
                            <label class="sanjiao"></label>
                            <span class="num">{$attendCount}</span>
                            <div class="subInfo" id="stateBox">
                                <div class="search">
                                    <i class="iconfont">&#xe6b5;</i>
                                    <div>
                                        <input type="text" placeholder="搜索人员" class="searchUser" value="" data-url="{:U(searchUser)}"/>
                                    </div>
                                </div>
                                <ul class="default">
                                    <li class="item item-hide" state="hide">
                                        <a>
                                            <span>外出人员</span>
                                            <label class="color1">{$outCount}</label>
                                            <em class="arrow"></em>
                                        </a>
                                        <dl>
                                            <foreach name="outList" item="out">
                                                <dd>
                                                    <img src="{$out.head|default='/Public/Admin/images/man.png'}" />
                                                    <span>{$out.user_id|getChineseName}</span>
                                                </dd>
                                            </foreach>
                                        </dl>
                                    </li>
                                    <li class="item item-hide" state="hide">
                                        <a>
                                            <span>出差人员</span>
                                            <label class="color3">{$evectionCount}</label>
                                            <em class="arrow"></em>
                                        </a>
                                        <dl>
                                            <foreach name="evectionList" item="evection">
                                                <dd>
                                                    <img src="{$evection.head|default='/Public/Admin/images/man.png'}" />
                                                    <span>{$evection.user_id|getChineseName}</span>
                                                </dd>
                                            </foreach>
                                        </dl>
                                    </li>
                                    <li class="item item-hide" state="hide">
                                        <a>
                                            <span>请假人员</span>
                                            <label class="color2">{$leaveCount}</label>
                                            <em class="arrow"></em>
                                        </a>
                                        <dl>
                                            <foreach name="leaveList" item="leave">
                                                <dd>
                                                    <img src="{$leave.head|default='/Public/Admin/images/man.png'}" />
                                                    <span>{$leave.user_id|getChineseName}</span>
                                                </dd>
                                            </foreach>
                                        </dl>
                                    </li>
                                </ul>
                                <ul class="search-ul hide"></ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="main clearfix">
                <div class="left">
                    <div class="section1 clearfix">
                        <div class="fl dayInfo">
                            <div class="box1">
                                <p class="time positionR"><font class="time2" style="color:#fff"></font><span class="en-time">AM</span></p>
                                <p class="date">2018-08-01</p>
                            </div>
                            <div class="box2">
                                <i class="iconfont fl">&#xe678;</i>
                                <div class="fl watherMore">
                                    <span class="wt">多云</span>
                                    <label class="c">28-35℃</label>
                                </div>
                            </div>
                            <div class="after hide">
                                <ul>
                                </ul>
                            </div>
                        </div>
                        <div class="userInfo fl">
                            <div class="box3 claerfix">
                                <img src="<if condition='$userinfo[head_url] neq null'>{$userinfo.head_url|default='/Public/Admin/images/man.png'}<else/>{$userinfo.head|default='/Public/Admin/images/man.png'}</if>" />
                                <div class="box31 displayIB">
                                    <span class="disB">{$userinfo.user_name}</span>
                                    <label class="disB">{$userinfo.dept_id|getDeptName}</label>
                                </div>
                                <div class="box32 fr positionR">
                                    <a href="{:U('Flow/lists',array('type'=>1))}">
                                        <i class="iconfont">&#xe642;</i>
                                        <span>{$runCount}</span>
                                        <label>待办流程</label>
                                    </a>
                                </div>
                            </div>
                            <div class="box4" id="box4" style="position:relative">
                                <div class="online">
                                    <a class="pointer onlineUser"><span>在线</span></a>
                                    <label>(在线人数{$onlineCount})</label>
                                    <a class="exit pointer" title="退出" href="{:U('Login/logout')}"><i class="iconfont fr iconfont1">&#xe61a;</i></a>
                                    <i class="iconfont fr iconfont2 setting">&#xe729;</i>
                                </div>
                                <div class="onlineList hide">
                                    <ul>
                                        <foreach name="onlineUser" item="user">
                                            <li><img src="{$user.head|default='/Public/Admin/images/man.png'}" width="30px"><span>[{$user.dept_id|getDeptName}] {$user.user_name}</span></li>
                                        </foreach>
                                    </ul>
                                </div>
                                <p>上次登录：{$userinfo.last_visit_time}<p>
                            </div>
                        </div>
                    </div>
                    <div class="section section2">
                        <h3 class="title"><span class="active">快速导航</span></h3>
                        <ul class="clearfix">
                            <foreach name="qNavs" item="nav">
                                <if condition="$nav['url'] eq '#'">
                                    <li><span><i class="iconfont" style="color:#999;cursor: none">&{$nav.nav_icon}</i><p>{$nav.nav_name}</p></span></li>
                                    <else/>
                                    <li><a href="/index.php/Home/{$nav.url}"><i class="iconfont">&{$nav.nav_icon}</i><p>{$nav.nav_name}</p></a></li>
                                </if>
                            </foreach>
                        </ul>
                    </div>
                    <div class="section section3">
                        <h3 class="title">
                            <a href="{:U('Personal/schedule')}"><span class="active fl">我的日历</span></a>
                            <a class="inseartEvent pointer"><i class="iconfont">&#xe638;</i>新增日程</a>
                            <a href="javascript:;" class="fr writeLog"><i class="iconfont">&#xe684;</i>写日志</a></h3>
                        <div id='container'></div>
                        <ul class="remindList" style="overflow: auto;height:93px">
                            <notempty name="calendars">
                            <foreach name="calendars" item="calendar">
                                <li class="clearfix">
                                        <a href="javascript:;" title="{$calendar.content}">
                                        <i class="iconfont remindIcon">&#xe6c6;</i>
                                        <label>{$calendar.remind_time|date="m-d H:i",###}</label>
                                        <span>{$calendar.title}</span>
                                        <div class="fr operation">
                                            <i class="iconfont deliconfont delete" data-url="{:U('Personal/delCalendar',array('id'=>$calendar['id']))}">&#xe698;</i>
                                            <i class="iconfont inseartEvent" data-id="{$calendar.id}">&#xe636;</i>
                                        </div>
                                    </a>
                                </li>
                            </foreach>
                                <else />
                                <li class="clearfix">暂无日程</li>
                            </notempty>
                        </ul>
                    </div>
                </div>
                <div class="middle">
                    <div class="section section6">
                        <h3 class="title" id="newsBox">
                            <span class="active" data-url="{:U('Personal/news')}">公司新闻</span>
                            <span data-url="{:U('Personal/news')}">新闻列表</span>
                            <span data-url="{:U('Personal/notice')}">公告通知</span>
                            <a href="{:U('Personal/news')}"  title="更多"><i class="iconfont fr">&#xe61b;</i></a>
                        </h3>
                        <div class="tabBox">
                            <div class="listBox">
                                <div class="list newsBanner positionR">
                                    <div class="swiper-container" style="height: 200px;">
                                        <div class="swiper-wrapper">
                                            <foreach name="imgNews" item="imgNew">
                                                <div class="swiper-slide positionR"><a href="{:U('Personal/readNews',array('news_id'=>$imgNew['news_id']))}"><img src="{$imgNew.uploads_url}" /><p><span>{$imgNew.subject}</span></p></a></div>
                                            </foreach>
                                        </div>
                                        <div class="pagination"></div>
                                    </div>
                                </div>
                                <ul class="list" style="display: none;">
                                    <foreach name="news" item="new">
                                        <li class="clearfix">
                                            <a href="{:U('Personal/readNews',array('news_id'=>$new['news_id']))}" title="{$new.subject}">
                                                <div class="content"><if condition="$new['noRead'] eq 1"><span class="dotted"></span></if>{$new.subject} </div><span class="time fr">{$new.news_time}</span>
                                            </a>
                                        </li>
                                    </foreach>
                                </ul>
                                <ul class="list" style="display: none;">
                                    <foreach name="notifys" item="notify">
                                        <li class="clearfix">
                                            <a href="{:U('Personal/readNotify',array('notify_id'=>$notify['notify_id']))}" title="{$notify.subject}">
                                                <div class="content"><if condition="$notify['noRead'] eq 1"><span class="dotted"></span></if>{$notify.subject} </div><span class="time fr">{$notify.audit_date}</span>
                                            </a>
                                        </li>
                                    </foreach>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="section section4">
                        <h3 class="title">
                            <span class="active">待办事项</span>
                            <a href="{:U('Flow/lists',array('type'=>1))}" title="更多"><i class="iconfont fr">&#xe61b;</i></a>
                        </h3>
                        <div class="tabBox">
                            <ul class="clearfix navList">
                                <li class="active" data-url="{:U('Flow/lists',array('type'=>1))}">流程待办</li>
                                <li data-url="{:U('Plan/index',array('sms_flag'=>0,'type'=>4))}">计划待办</li>
                                <li data-url="#">其他待办</li>
                            </ul>
                            <div class="listBox">
                                <ul class="list">
                                    <notempty name="runs">
                                        <foreach name="runs" item="run" key="key">
                                            <li class="clearfix">
                                                <a href="{:U('Flow/form',array('id'=>$run['flow_type']['form_id'],'flow_id'=>$run['flow_id'],'run_id'=>$run['run_id'],'currPrcs'=>$run['currPrcs']))}" title="{$run.run_name}">
                                                    <div class="dbcont content">
                                                        <if condition="$key eq 0">
                                                            <span class="tj workLabel">特急</span>
                                                            <elseif condition="$key lt 3"/>
                                                            <span class="j workLabel">急</span>
                                                        </if>
                                                        {$run.run_name} ({$run.begin_user|getChineseName})</div><span class="time fr">{$run.date}</span>
                                                </a>
                                            </li>
                                        </foreach>
                                        <else />
                                        <li class="clearfix">
                                            <a href="javascript:;">
                                                <label class="dbcont content">暂无待办流程 </label><span class="time fr"></span>
                                            </a>
                                        </li>
                                    </notempty>
                                </ul>
                                <ul class="list" style="display: none;">
                                    <notempty name="plans">
                                        <foreach name="plans" item="plan" key="key">
                                            <li class="clearfix">
                                                <a href="{:U('Plan/show',array('id'=>$plan['plan_id'],'type'=>4,'sms_flag'=>0))}" title="{$plan.name}">
                                                    <div class="dbcont content">{$key+1}. [{$plan.type|getPlanType}] {$plan.name} </div><span class="time fr">{$plan.begin_date}</span>
                                                </a>
                                            </li>
                                        </foreach>
                                        <else/>
                                        <li class="clearfix">
                                            <a href="javascript:;">
                                                <label class="dbcont content">暂无待办计划 </label><span class="time fr"></span>
                                            </a>
                                        </li>
                                    </notempty>
                                </ul>
                                <ul class="list" style="display: none;">
                                    <li class="clearfix">
                                        <a href="javascript:;">
                                            <label class="dbcont content">暂无其他待办 </label><span class="time fr"></span>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="section section5">
                        <h3 class="title">
                            <span class="active">工作计划</span>
                            <a href="{:U('Plan/index',array('sms_flag'=>0,'type'=>4))}" title="更多"><i class="iconfont fr">&#xe61b;</i></a>
                        </h3>
                        <div class="tabBox">   
                            <ul class="clearfix navList">
                                <foreach name="planTypes" item="type" key="key">
                                    <li class="{$key == 0 ? 'active' : ''}">{$type.type_name}</li>
                                </foreach>
                            </ul>
                            <div class="listBox">
                                <foreach name="planTypes" item="type" key='key'>
                                    <ul class="list" {$key > 0 ? 'style="display:none"' : ''}>
                                        <notempty name="type.plans">
                                            <foreach name="type.plans" item="plan">
                                                <li class="clearfix">
                                                    <a href="{:U('Plan/show',array('id'=>$plan['plan_id'],'type'=>4,'sms_flag'=>0))}" title="{$plan.name}">
                                                        <div class="content">
                                                            <if condition="$plan['noRead'] eq 1">
                                                                <span class="dotted"></span>
                                                            </if>
                                                            {$key+1}. {$plan.name}</div><span class="time fr">{$plan.begin_date}</span>
                                                    </a>
                                                </li>
                                            </foreach>
                                            <else/>
                                            <li class="clearfix">暂无数据</li>
                                        </notempty>
                                    </ul>
                                </foreach>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="right">
                    <div class="section section7">
                        <h3 class="title">
                            <span class="active">最新动态</span>
                        </h3>
                        <ul class="clearfix">
                            <li><a href="{:U('Flow/lists',array('type'=>1))}" class="bg1">流程审批</a><span class="num bg1">{$runCount}</span></li>
                            <li><a href="{:U('Plan/index',array('sms_flag'=>0,'type'=>4))}" class="bg2">工作计划</a><span class="num bg2">{$planNoRead}</span></li>
                            <li><a href="{:U('Personal/notice')}" class="bg3">公告通知</a><span class="num bg3">{$notifyNoRead}</span></li>
                            <li><a href="#" class="bg4 newEmail">电子邮件</a><span class="num bg4">{$newCount}</span></li>
                            <li><a href="{:U('Personal/news')}" class="bg5">新闻动态</a><span class="num bg5">{$newsNoRead}</span></li>
                            <li><a href="{:U('Personal/email')}" class="bg6">假期结余</a><span class="num bg6">{$vacation}</span></li>
                        </ul>
                        <input type='hidden' id='loginEmail' value="{:U('loginEamil')}">
                    </div>
                    <div class="section section8">
                        <h3 class="title" style="margin:0"><span class="active">本月工作统计</span><input type="text" value="7月" class="month fr" readonly="readonly" /></h3>					
                        <div id="echart1"></div>
                    </div>
                    <div class="section section9">
                        <h3 class="title"><span class="active">自助查询</span></h3>
                        <div class="searchBox positionR">
                            <ul>
                                <li class="txlSearch"><i class="iconfont iconfont1">&#xe61e;</i>通讯录查询</li>
                                <li class="hysSearch"><i class="iconfont iconfont2">&#xe620;</i>会议室查询</li>
                            </ul>
                            <div class="inputWrap inputWrap1" style="display: none;overflow: auto">
                                <div class="inputBox active">
                                    <i class="iconfont">&#xe6b5;</i>
                                    <input type="text" placeholder="请输入员工姓名" class="name submitEnter" data-url="{:U('enterSearch',array('table'=>'address'))}"/>
                                </div>
                                <div class="list">
                                </div>
                            </div>
                            <div class="inputWrap inputWrap1" style="display: none;">
                                <div class="inputBox active active2">
                                    <i class="iconfont">&#xe6b5;</i>
                                    <input type="text" placeholder="暂未开放" class="name submitEnter" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <input type="hidden" id="watherUrl" value="{:U('getWather')}" />
        <input type="hidden" id="echartsUrl" value="{:U('getEchartsData')}" />
        <input type="hidden" name="lng" value="" />
        <input type="hidden" name="lat" value="" />
        <input type="hidden" id="getFlowCountUrl" value="{:U('getFlowCount')}">
        <input type="hidden" id="getCalendarUrl" value="{:U('getCalendar')}">
        <input type="hidden" id="getRemindViewUrl" value="{:U('getRemindView')}">

        <script type="text/javascript" src="/Public/Admin/js/common.js" ></script>
        <script type="text/javascript">
            $(initIndex())
            $(function () {
                //鼠标移动显示在线人员
                $('.onlineUser').on('mouseover', function () {
                    $('.onlineList').fadeIn();
                }).on('mouseleave', function () {
                    $('.onlineList').fadeOut();
                })

                //鼠标移动显示未来三日天气
                $('.watherMore').on('mouseover', function () {
                    $('.after').fadeIn();
                }).on('mouseleave', function () {
                    $('.after').fadeOut();
                })

                //新增日程
                $(document).on("click", ".section3 .inseartEvent", function () {
                    var data = getCalendarDate();
                    var id = $(this).attr('data-id');
                    console.log(data);
                    var document_w = $(window).width();
                    var document_h = $(window).height();
                    var layer_w = '450';
                    var layer_h = '650';
                    var w = (document_w - layer_w) / 2;
                    var h = (document_h - layer_h) / 2;
                    layer.open({
                        type: 2,
                        title: [
                            "新建日程",
                            'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
                        ],
                        area: [layer_w + 'px', layer_h + 'px'], //宽高
                        offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
                        content: "/index.php/Home/Personal/event/date/" + data + '/id/' + id,
                    })
                });

                //点击日期显示日程
                $("#container .sc-item .day").on('click', function () {
                    var day = $(this).text();
                    var date = getCalendarDate(1) + '-' + day;
                    var url = $('#getCalendarUrl').val() + '?date='+date;
                    $.get(url,function(res){
                        console.log(res);
                        if(res){
                            var html = '';
                            for(var i=0; i<res.length; i++){
                                html += '<li class="clearfix"><a href="javascript:;" title="'+res[i].content+'"><i class="iconfont remindIcon">&#xe6c6;</i>';
                                html += '<label>&nbsp;'+res[i].remind_time+'</label>';
                                html += '<span>'+res[i].title+'</span>';
                                html += '<div class="fr operation"><i class="iconfont deliconfont delete" data-url="/index.php/Home/Personal/delCalendar/id/'+res[i].id+'">&#xe698;</i>';
                                html += '<i class="iconfont inseartEvent" data-id="'+res[i].id+'">&#xe636;</i></div></a></li>';
                            }
                        }
                        $('.remindList').html(html)
                    })
                })
                //写日志
                $(document).on("click", ".section3 .writeLog", function () {
                    var date = getCalendarDate();
                    var document_w = $(window).width();
                    var document_h = $(window).height();
                    var layer_w = '550';
                    var layer_h = '550';
                    var w = (document_w - layer_w) / 2;
                    var h = (document_h - layer_h) / 2;
                    layer.open({
                        type: 2,
                        title: [
                            "写日志",
                            'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
                        ],
                        area: [layer_w + 'px', layer_h + 'px'], //宽高
                        offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
                        content: "/index.php/Home/Index/layer/type/15/date/" + date
                    })
                });

                //获取插件中日期
                function getCalendarDate(type) {
                    var day = $("#container .sc-selected").find(".day").text();
                    if (day == '') {
                        day = $("#container .sc-today").find(".day").text();
                    }
                    var month = $("#container .sc-select-month").val();
                    var year = $("#container .sc-select-year").val()
                    if (type == 1) {
                        return year + '-' + month
                    } else {
                    return year + '-' + month + '-' + day;
                    }
                }

                //搜索人员
                $('.searchUser').bind('keypress', function (event) {
                    if (event.keyCode == "13") {
                        var url = $(this).attr('data-url') + '?name=' + $(this).val();
                        $.get(url, function (res) {
                            console.log(res);
                            if (res) {
                                var html = '<li class="item item-hide" state="hide"><a>';
                                html += '<span>' + res.attendType + '</span>';
                                html += '<label class="color1">1</label><em class="arrow"></em></a>';
                                html += '<dl><dd><img src="' + res.head + '" />';
                                html += '<span>' + res.username + '</span></dd></dl></li>';
                            } else {
                                var html = '<li class="item item-hide" state="hide"><a><span>该员工今天在岗</span></a></li>';
                            }
                            $('#stateBox .search-ul').show();
                            $('#stateBox .default').hide();
                            $('#stateBox .search-ul').html(html);
                        })
                    }
                })

                //鼠标移入显示用户
                $('.headIcon i').on('mouseover', function () {
                    $('#stateBox .search-ul').hide();
                    $('#stateBox .default').show();
                    $('.searchUser').val('');
                })
            });

            //提出问题与建议
            $('.question').click(function () {
                var document_w = $(window).width();
                var document_h = $(window).height();
                var layer_w = '550';
                var layer_h = '350';
                var w = (document_w - layer_w) / 2;
                var h = (document_h - layer_h) / 2;
                layer.open({
                    type: 2,
                    title: [
                        "问题与建议",
                        'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
                    ],
                    area: [layer_w + 'px', layer_h + 'px'], //宽高
                    offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
                    content: "/index.php/Home/Index/layer/type/19"
                })
            })
            //问题列表
            $('.questionList').click(function () {
                var document_w = $(window).width();
                var document_h = $(window).height();
                var layer_w = '550';
                var layer_h = '450';
                var w = (document_w - layer_w) / 2;
                var h = (document_h - layer_h) / 2;
                layer.open({
                    type: 2,
                    title: [
                        "问题与建议",
                        'background-color: #437dba;color:#fff;text-align:center;font-size:1.4em',
                    ],
                    area: [layer_w + 'px', layer_h + 'px'], //宽高
                    offset: [h + 'px', w + 'px'], //弹出位置 [top,left]
                    content: "/index.php/Home/Index/layer/type/20"
                })
            })
        </script>
    </body>
</html>
